package com.abe.abetest.widget;

import android.content.Context;
import android.util.AttributeSet;
import android.view.KeyEvent;
import android.view.View;

import com.abe.abetest.R;
import com.abe.abetest.utils.CommonUtils;
import com.abe.libcore.view.common.BaseCustomView;

public class YaoView extends BaseCustomView {
    public YaoView(Context context) {
        this(context, null);
    }

    public YaoView(Context context, AttributeSet attrs) {
        this(context, attrs, 0);
    }

    public YaoView(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        focus();
    }

    @Override
    protected int getRootViewId() {
        return R.id.item_yao_v;
    }

    @Override
    protected int getLayoutId() {
        return R.layout.item_view_yao;
    }

    @Override
    protected void initContent() {
        customRootView.findViewById(R.id.item_yao_v).setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                dismiss();
            }
        });
    }

    @Override
    public boolean onKeyDown(int keyCode, KeyEvent event) {
        CommonUtils.wf("keyCode:%d", keyCode);
        if (keyCode == KeyEvent.KEYCODE_BACK) {
            dismiss();
            return true;
        }
        return super.onKeyDown(keyCode, event);
    }
}